#include "sqlist.h"
int main() {
    SqList L;   // 定义一个顺序表变量
    //定义一个数组
    ElemType a[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};

    //创建顺序表
    CreateList(&L, a, 9);
    PrintList(&L);  // 打印顺序表

    // 查找元素
    int pos = FindByValue(&L, 10);
    printf("pos = %d\n", pos);

    pos = FindByValue(&L, 1);
    printf("pos = %d\n", pos);

    // 往顺序表指定位置i插入元素e
    bool s = ListInsert(&L, 100, 1);
    if (s == true) {
        printf("insert success\n");
    } else {
        printf("insert failed\n");
    }
    PrintList(&L);

    s = ListInsert(&L, 10, 1);
    if (s == true) {
        printf("insert success\n");
    } else {
        printf("insert failed\n");
    }
    PrintList(&L);

    // 删除指定位置的元素
    s = ListDelete(&L, 10, &pos);
    if (s == true) {
        printf("delete success\n");
    } else {
        printf("delete failed\n");
    }
    PrintList(&L);

    // 删除指定值的元素
    s = ListlocalDelete(&L, 10);
    if (s == true) {
        printf("delete success\n");
    } else {
        printf("delete failed\n");
    }
    PrintList(&L);

    return 0;
}